import collections
#有序字典
error_dict = collections.OrderedDict()
while True:
    try:
        filename_row = input().split()
        #获取文件名
        filename = filename_row[0][filename_row[0].rfind('\\')+1:]
        #获取行号
        row = filename_row[1]
        #记录错误次数
        if (filename, row) in error_dict:
            error_dict[(filename, row)] += 1
        else:
            error_dict[(filename, row)] = 1
    except:
        break
print(error_dict.items())
error_dict = error_dict.items()
#取出order字典内的列表
sort_dict = sorted(error_dict, key=lambda x: x[1], reverse=True)
error_count = 0
for each in sort_dict:
    error_count += 1
    if error_count <= 8:
        name = each[0][0]
        if len(name)>16:
            name = name[-16:]
        row = each[0][1]
        count = each[1]
        print(' '.join([name, str(row), str(count)]))
    else:
        break

# 逻辑上没有啥问题，还有优化的空间